/* 
 * Enterprise Library Extensions - DI + ORM.
 * Copyright (C) 2006
 *
 * GNU General Public License
 *
 * This program is free software; you can redistribute 
 * it and/or modify it under the terms of the GNU General Public License 
 * as published by the Free Software Foundation; either version 2 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU General Public License for more details.
 */
using System;
using System.Collections.Generic;
using System.Text;

namespace ELE.EnterpriseLibrary.Naming.Configuration
{
  /// <summary>
  /// Configuration data that defines using a factory when creating naming context components
  /// </summary>
  public class ComponentInitializationFactory
  {
    private ClassAssemblyPair factoryType;
    private string factoryMethod;
    private ComponentInitializerCollection factoryMethodParameters;
    /// <summary>
    /// The type used when calling the factory method by using reflection.
    /// </summary>
    public ClassAssemblyPair FactoryType
    {
      get { return factoryType; }
      set { factoryType = value; }
    }
    /// <summary>
    /// Name of the method from the factory used to create the component
    /// </summary>
    public string FactoryMethod
    {
      get { return factoryMethod; }
      set { factoryMethod = value; }
    }
    /// <summary>
    /// Parameters, if any, that are to be passed into the method when creating the component.
    /// </summary>
    public ComponentInitializerCollection FactoryMethodParameters
    {
      get { return factoryMethodParameters; }
      set { factoryMethodParameters = value; }
    }
    /// <summary>
    /// Utility method to add paarameter definitions for the factory method
    /// </summary>
    /// <param name="param"></param>
    public void AddParameter(ComponentInitializer param)
    {
      if (factoryMethodParameters == null)
      {
        factoryMethodParameters = new ComponentInitializerCollection();
      }
      factoryMethodParameters.Add(param);
    }

  }
}
